home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
pas_0593.zip
/
MAKENEWS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-05-30
|
3KB
|
73 lines
{─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
Msg : 209 of 773
From : Chad Thevis 1:3811/210.0 03 May 93 17:59
To : Ron Phillips
Subj : ANSI
────────────────────────────────────────────────────────────────────────────────
RP> I have TheDraw! Your not understanding what I want to do. I want to make
RP> news file like "DGBG" "NewsFlash" and "NewsFile" like them. You write your
RP> news in a txt file editor then run it with the newsfile and it makes your
RP> ansi and ascii screen. I can't get any more specific than this.
Here is a very simple example of how to do this. Hope it helps some.
I threw it together in about 15 minutes but it does run.}
Program MakeNews;
Var
x,cnt : integer;
s:char;
ans,asc:text;
date : string;
news : array[1..50] of string;
Begin
assign(ans,'news.ans');
rewrite(ans);
assign(asc,'news.asc');
rewrite(asc);
s:=chr(27); { This is the char }
write('What is the date > ');
readln(date);
write(ans,s,'[0m'); { This clears all ansi attributes }
write(ans,s,'[34;47m'); { This Makes output Blue with While Lettering}
writeln(ans,'╔══════════════════════════════════════════════════════════════════╗',s,'[0m');
write(ans,s,'[34;47m');
writeln(ans,'║ The News on My BBS ║',s,'[0m');
write(ans,s,'[34;47m');
writeln(ans,'╚══════════════════════════════════════════════════════════════════╝',s,'[0m');
writeln(asc,'╔══════════════════════════════════════════════════════════════════╗');
writeln(asc,'║ The News on My BBS ║');
writeln(asc,'╚══════════════════════════════════════════════════════════════════╝');
writeln(ans);
writeln(asc);
cnt := 0;
Repeat {This lets you enter the text}
cnt:=cnt+1; {I didn't test for the array size, but}
readln(news[cnt]); {50 lines should be enough. You could read}
until news[cnt] = 'XXX'; {this from a file and do it that way}
writeln(ans,s,'[33;1;5m',date,s,'[0m'); {It'll accept input until you}
writeln(ans); {enter XXX, but I hope you
guessed that}
writeln(asc,date);
writeln(asc);
for x:= 1 to cnt-1 do
begin
writeln(ans,s,'[34;1m',news[x]); {And this writes is out to the
file}
writeln(asc,news[x]);
end;
writeln(ans,s,'[0m'); {This clears all ansi codes}
close(ans);
close(asc);
end.
I noticed that it strippd the backwards arrow CHR(27) from the
comment. But anyway, that's what it is. You might also want to
put a CHR(27)[2J at the beginning of the ANS file to cause it to
clear the screen when it's displayed. And also at the end you could
put the CHR(1), the smiley face to make it wait for <ENTER> to continue.
It'll work in the BBS, not when you just type the file. You can find
these codes in the DOS book under ANSI.SYS - Ansi escape sequences.